<template>
  <el-dialog :title="!dataForm.id ? '新建' :'编辑'"
             :close-on-click-modal="false" append-to-body
             :visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
             width="80%">
    <el-row :gutter="15" class="">
      <el-form ref="elForm" :model="dataForm" :rules="rules" size="medium" label-width="100px" label-position="right">
        <template v-if="!loading">
          <el-col :span="24">
            <el-card class="mb-20" shadow="always" header="基本信息">
              <el-col :span="8">
                <el-form-item label="客户名称"
                              prop="customerName">
                  <el-input v-model="dataForm.customerName"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>

                  </el-input>
                </el-form-item>
              </el-col>
<!--              <el-col :span="8">-->
<!--                <el-form-item label="项目"-->
<!--                              prop="project">-->
<!--                  <el-select v-model="dataForm.project"-->
<!--                             placeholder="请选择" clearable :style='{"width":"100%"}'>-->
<!--                    <el-option v-for="(item, index) in projectOptions" :key="index" :label="item.fullName"-->
<!--                               :value="item.id" :disabled="item.disabled"></el-option>-->

<!--                  </el-select>-->
<!--                </el-form-item>-->
<!--              </el-col>-->
              <el-col :span="8">
                <el-form-item label="客户来源"
                              prop="customerSource">
                  <el-select v-model="dataForm.customerSource"
                             placeholder="请选择" clearable :style='{"width":"100%"}'>
                    <el-option v-for="(item, index) in customerSourceOptions" :key="index" :label="item.fullName"
                               :value="item.id" :disabled="item.disabled"></el-option>

                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="客户类型"
                              prop="customerType">
                  <el-radio-group v-model="dataForm.customerType"
                                  size="small">
                    <el-radio v-for="(item, index) in customerTypeOptions" :key="index" :label="item.id"
                              :disabled="item.disabled">
                      {{ item.fullName }}
                    </el-radio>

                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="客户性质"
                              prop="customerNature">
                  <el-radio-group v-model="dataForm.customerNature"
                                  size="small">
                    <el-radio v-for="(item, index) in customerNatureOptions" :key="index" :label="item.id"
                              :disabled="item.disabled">
                      {{ item.fullName }}
                    </el-radio>

                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="是否属于九小" prop="customerNature">
                  <el-radio-group v-model="dataForm.isLongTermPlace" size="small">
                    <el-radio label="是">是</el-radio>
                    <el-radio label="否">否</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="客户所属行业"
                              prop="customersIndustry">
<!--                  <el-select v-model="dataForm.customersIndustry"-->
<!--                             placeholder="请选择" clearable :style='{"width":"100%"}'>-->
<!--                    <el-option v-for="(item, index) in customersIndustryOptions" :key="index" :label="item.fullName"-->
<!--                               :value="item.id" :disabled="item.disabled"></el-option>-->

<!--                  </el-select>-->
                  <el-input v-model="dataForm.customersIndustry"
                            placeholder="请输入客户所属行业" clearable :style='{"width":"100%"}'>

                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="社会信用代码/身份证"
                              prop="customerCreditCode">
                  <el-input v-model="dataForm.customerCreditCode"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>

                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="详细地址"
                              prop="detailedAddress">
                  <el-input v-model="dataForm.detailedAddress"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>

                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="备注"
                              prop="notes">
                  <el-input v-model="dataForm.notes"
                            placeholder="请输入" :style='{"width":"100%"}' true type="textarea"
                            :autosize='{"minRows":4,"maxRows":4}'>

                  </el-input>
                </el-form-item>
              </el-col>
            </el-card>
          </el-col>
          <el-col :span="24">
            <el-card class="mb-20" shadow="always" header="联系人">
              <el-col :span="8">
                <el-form-item label="联系人"
                              prop="jnpf_zcgl_customer_user_jnpf_contacts">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_user_jnpf_contacts"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="联系电话"
                              prop="jnpf_zcgl_customer_user_jnpf_contactNumber">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_user_jnpf_contactNumber"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="邮箱"
                              prop="jnpf_zcgl_customer_user_jnpf_email">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_user_jnpf_email"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="职位"
                              prop="jnpf_zcgl_customer_user_jnpf_position">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_user_jnpf_position"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
            </el-card>
          </el-col>
          <el-col :span="24">
            <el-card class="mb-20" shadow="always" header="工商信息">
              <el-col :span="8">
                <el-form-item label="法定代表人"
                              prop="jnpf_zcgl_customer_business_jnpf_legalRepresentative">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_legalRepresentative"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="注册资本"
                              prop="jnpf_zcgl_customer_business_jnpf_registeredCapital">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_registeredCapital"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="成立日期"
                              prop="jnpf_zcgl_customer_business_jnpf_establishmentDate">
                  <el-date-picker v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_establishmentDate"
                                  placeholder="请选择" clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd"
                                  value-format="timestamp">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="经营状态"
                              prop="jnpf_zcgl_customer_business_jnpf_businessStatus">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_businessStatus"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="工商注册号"
                              prop="jnpf_zcgl_customer_business_jnpf_businessRegistrationNumber">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_businessRegistrationNumber"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="统一社会信用代码"
                              prop="jnpf_zcgl_customer_business_jnpf_creditCode">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_creditCode"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="组织机构代码"
                              prop="jnpf_zcgl_customer_business_jnpf_organizationCode">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_organizationCode"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="纳税人识别号"
                              prop="jnpf_zcgl_customer_business_jnpf_taxpayerNumber">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_taxpayerNumber"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="企业类型"
                              prop="jnpf_zcgl_customer_business_jnpf_enterpriseType">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_enterpriseType"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="营业期限开始时间"
                              prop="jnpf_zcgl_customer_business_jnpf_startTime">
                  <el-date-picker v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_startTime"
                                  placeholder="请选择" clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd"
                                  value-format="timestamp">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="营业期限结束时间"
                              prop="jnpf_zcgl_customer_business_jnpf_endTime">
                  <el-date-picker v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_endTime"
                                  placeholder="请选择" clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd"
                                  value-format="timestamp">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="行业"
                              prop="jnpf_zcgl_customer_business_jnpf_industry">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_industry"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="核准日期"
                              prop="jnpf_zcgl_customer_business_jnpf_approvalDate">
                  <el-date-picker v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_approvalDate"
                                  placeholder="请选择" clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd"
                                  value-format="timestamp">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="实缴资本"
                              prop="jnpf_zcgl_customer_business_jnpf_paidCapital">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_paidCapital"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="人员规模"
                              prop="jnpf_zcgl_customer_business_jnpf_stafsize">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_stafsize"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="参保人数"
                              prop="jnpf_zcgl_customer_business_jnpf_individualsNumber">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_individualsNumber"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="登记机关"
                              prop="jnpf_zcgl_customer_business_jnpf_registrationAuthority">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_registrationAuthority"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="曾用名"
                              prop="jnpf_zcgl_customer_business_jnpf_formerName">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_formerName"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="英文名"
                              prop="jnpf_zcgl_customer_business_jnpf_englishName">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_englishName"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="注册地址"
                              prop="jnpf_zcgl_customer_business_jnpf_registeredAddress">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_registeredAddress"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="经营范围"
                              prop="jnpf_zcgl_customer_business_jnpf_businessScope">
                  <el-input v-model=" dataForm.jnpf_zcgl_customer_business_jnpf_businessScope"
                            placeholder="请输入" clearable :style='{"width":"100%"}'>
                  </el-input>
                </el-form-item>
              </el-col>
            </el-card>
          </el-col>
        </template>
      </el-form>
      <SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm"
                    ref="selectDialog" @select="addForSelect" @close="selectDialogVisible=false"/>
    </el-row>
    <span slot="footer" class="dialog-footer">
        <el-button @click="visible = false"> 取 消</el-button>
        <el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"> 确 定</el-button>
    </span>
  </el-dialog>
</template>
<script>
import request from '@/utils/request'
import {getDataInterfaceRes} from '@/api/systemData/dataInterface'
import {getDictionaryDataSelector} from '@/api/systemData/dictionary'

export default {
  components: {},
  props: [],
  data() {
    return {
      visible: false,
      loading: false,
      btnLoading: false,
      selectDialogVisible: false,
      currTableConf: {},
      addTableConf: {},
      tableRows: {},
      currVmodel: "",
      dataForm: {
        isLongTermPlace: '否',
        customerName: '',
        project: "",
        customerSource: "",
        customerType: '',
        customerNature: '',
        customersIndustry: "",
        customerCreditCode: '',
        detailedAddress: '',
        notes: '',
        zcgl_customer_business:
          {
            legalRepresentative: '',
            registeredCapital: '',
            establishmentDate: '',
            businessStatus: '',
            businessRegistrationNumber: '',
            creditCode: '',
            organizationCode: '',
            taxpayerNumber: '',
            enterpriseType: '',
            startTime: '',
            endTime: '',
            industry: '',
            approvalDate: '',
            paidCapital: '',
            stafsize: '',
            individualsNumber: '',
            registrationAuthority: '',
            formerName: '',
            englishName: '',
            registeredAddress: '',
            businessScope: '',
          },
        zcgl_customer_user:
          {
            contacts: '',
            contactNumber: '',
            email: '',
            position: '',
          },
        jnpf_zcgl_customer_user_jnpf_contacts: '',
        jnpf_zcgl_customer_user_jnpf_contactNumber: '',
        jnpf_zcgl_customer_user_jnpf_email: '',
        jnpf_zcgl_customer_user_jnpf_position: '',
        jnpf_zcgl_customer_business_jnpf_legalRepresentative: '',
        jnpf_zcgl_customer_business_jnpf_registeredCapital: '',
        jnpf_zcgl_customer_business_jnpf_establishmentDate: '',
        jnpf_zcgl_customer_business_jnpf_businessStatus: '',
        jnpf_zcgl_customer_business_jnpf_businessRegistrationNumber: '',
        jnpf_zcgl_customer_business_jnpf_creditCode: '',
        jnpf_zcgl_customer_business_jnpf_organizationCode: '',
        jnpf_zcgl_customer_business_jnpf_taxpayerNumber: '',
        jnpf_zcgl_customer_business_jnpf_enterpriseType: '',
        jnpf_zcgl_customer_business_jnpf_startTime: '',
        jnpf_zcgl_customer_business_jnpf_endTime: '',
        jnpf_zcgl_customer_business_jnpf_industry: '',
        jnpf_zcgl_customer_business_jnpf_approvalDate: '',
        jnpf_zcgl_customer_business_jnpf_paidCapital: '',
        jnpf_zcgl_customer_business_jnpf_stafsize: '',
        jnpf_zcgl_customer_business_jnpf_individualsNumber: '',
        jnpf_zcgl_customer_business_jnpf_registrationAuthority: '',
        jnpf_zcgl_customer_business_jnpf_formerName: '',
        jnpf_zcgl_customer_business_jnpf_englishName: '',
        jnpf_zcgl_customer_business_jnpf_registeredAddress: '',
        jnpf_zcgl_customer_business_jnpf_businessScope: '',
      },
      rules:
        {
          customerName: [
            {
              required: true,
              message: '请输入',
              trigger: 'blur'
            },
          ],
          project: [
            {
              required: true,
              message: '请选择',
              trigger: 'change'
            },
          ],
          customerSource: [
            {
              required: true,
              message: '请选择',
              trigger: 'change'
            },
          ],


        },
      projectOptions: [],
      customerSourceOptions: [],
      customerTypeOptions: [{"fullName": "办公", "id": "1"}, {"fullName": "商业", "id": "2"}],
      customerNatureOptions: [{"fullName": "企业", "id": "1"}, {"fullName": "个人", "id": "2"}],
      customersIndustryOptions: [],

    }
  },
  computed: {},
  watch: {},
  created() {
    this.getprojectOptions();
    this.getcustomerSourceOptions();
    this.getcustomersIndustryOptions();
  },
  mounted() {
  },
  methods: {
    getprojectOptions() {
      getDictionaryDataSelector('600000000000000005').then(res => {
        this.projectOptions = res.data.list
      })
    },
    getcustomerSourceOptions() {
      getDictionaryDataSelector('600000000000000004').then(res => {
        this.customerSourceOptions = res.data.list
      })
    },
    getcustomersIndustryOptions() {
      getDictionaryDataSelector('600000000000000004').then(res => {
        this.customersIndustryOptions = res.data.list
      })
    },
    clearData() {
      this.dataForm.customerName = '';
      this.dataForm.project = "";
      this.dataForm.customerSource = "";
      this.dataForm.customerType = '';
      this.dataForm.customerNature = '';
      this.dataForm.customersIndustry = "";
      this.dataForm.customerCreditCode = '';
      this.dataForm.detailedAddress = '';
      this.dataForm.notes = '';
      this.dataForm.zcgl_customer_business.legalRepresentative = '';
      this.dataForm.zcgl_customer_business.registeredCapital = '';
      this.dataForm.zcgl_customer_business.establishmentDate = '';
      this.dataForm.zcgl_customer_business.businessStatus = '';
      this.dataForm.zcgl_customer_business.businessRegistrationNumber = '';
      this.dataForm.zcgl_customer_business.creditCode = '';
      this.dataForm.zcgl_customer_business.organizationCode = '';
      this.dataForm.zcgl_customer_business.taxpayerNumber = '';
      this.dataForm.zcgl_customer_business.enterpriseType = '';
      this.dataForm.zcgl_customer_business.startTime = '';
      this.dataForm.zcgl_customer_business.endTime = '';
      this.dataForm.zcgl_customer_business.industry = '';
      this.dataForm.zcgl_customer_business.approvalDate = '';
      this.dataForm.zcgl_customer_business.paidCapital = '';
      this.dataForm.zcgl_customer_business.stafsize = '';
      this.dataForm.zcgl_customer_business.individualsNumber = '';
      this.dataForm.zcgl_customer_business.registrationAuthority = '';
      this.dataForm.zcgl_customer_business.formerName = '';
      this.dataForm.zcgl_customer_business.englishName = '';
      this.dataForm.zcgl_customer_business.registeredAddress = '';
      this.dataForm.zcgl_customer_business.businessScope = '';
      this.dataForm.zcgl_customer_user.contacts = '';
      this.dataForm.zcgl_customer_user.contactNumber = '';
      this.dataForm.zcgl_customer_user.email = '';
      this.dataForm.zcgl_customer_user.position = '';
      this.dataForm.jnpf_zcgl_customer_user_jnpf_contacts = '';
      this.dataForm.jnpf_zcgl_customer_user_jnpf_contactNumber = '';
      this.dataForm.jnpf_zcgl_customer_user_jnpf_email = '';
      this.dataForm.jnpf_zcgl_customer_user_jnpf_position = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_legalRepresentative = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_registeredCapital = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_establishmentDate = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_businessStatus = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_businessRegistrationNumber = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_creditCode = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_organizationCode = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_taxpayerNumber = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_enterpriseType = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_startTime = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_endTime = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_industry = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_approvalDate = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_paidCapital = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_stafsize = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_individualsNumber = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_registrationAuthority = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_formerName = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_englishName = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_registeredAddress = '';
      this.dataForm.jnpf_zcgl_customer_business_jnpf_businessScope = '';
    },
    init(id) {
      this.dataForm.id = id || 0;
      this.visible = true;
      this.$nextTick(() => {
        this.$refs['elForm'].resetFields();
        if (this.dataForm.id) {
          this.loading = true
          request({
            url: '/api/example/ZcglCustomer/' + this.dataForm.id,
            method: 'get'
          }).then(res => {
            this.dataInfo(res.data)
            this.loading = false
          });
        } else {
          this.clearData()
        }
      });
      this.$store.commit('generator/UPDATE_RELATION_DATA', {})
    },
    // 表单提交
    dataFormSubmit() {
      this.$refs['elForm'].validate((valid) => {
        if (valid) {
          this.request()
        }
      })
    },
    request() {
      this.btnLoading = true
      let _data = this.dataList()
      if (!this.dataForm.id) {
        request({
          url: '/api/example/ZcglCustomer',
          method: 'post',
          data: _data
        }).then((res) => {
          this.$message({
            message: res.msg,
            type: 'success',
            duration: 1000,
            onClose: () => {
              this.visible = false
              this.btnLoading = false
              this.$emit('refresh', true)
            }
          })
        }).catch(() => {
          this.btnLoading = false
        })
      } else {
        request({
          url: '/api/example/ZcglCustomer/' + this.dataForm.id,
          method: 'PUT',
          data: _data
        }).then((res) => {
          this.$message({
            message: res.msg,
            type: 'success',
            duration: 1000,
            onClose: () => {
              this.visible = false
              this.btnLoading = false
              this.$emit('refresh', true)
            }
          })
        }).catch(() => {
          this.btnLoading = false
        })
      }
    },
    openSelectDialog(key) {
      this.currTableConf = this.addTableConf[key]
      this.currVmodel = key
      this.selectDialogVisible = true
      this.$nextTick(() => {
        this.$refs.selectDialog.init()
      })
    },
    addForSelect(data) {
      for (let i = 0; i < data.length; i++) {
        let item = {...this.tableRows[this.currVmodel], ...data[i]}
        this.dataForm[this.currVmodel].push(item)
      }
    },
    dataList() {
      var _data = JSON.parse(JSON.stringify(this.dataForm));
      _data.zcgl_customer_user.contacts = _data.jnpf_zcgl_customer_user_jnpf_contacts
      _data.zcgl_customer_user.contactNumber = _data.jnpf_zcgl_customer_user_jnpf_contactNumber
      _data.zcgl_customer_user.email = _data.jnpf_zcgl_customer_user_jnpf_email
      _data.zcgl_customer_user.position = _data.jnpf_zcgl_customer_user_jnpf_position
      _data.zcgl_customer_business.legalRepresentative = _data.jnpf_zcgl_customer_business_jnpf_legalRepresentative
      _data.zcgl_customer_business.registeredCapital = _data.jnpf_zcgl_customer_business_jnpf_registeredCapital
      _data.zcgl_customer_business.establishmentDate = _data.jnpf_zcgl_customer_business_jnpf_establishmentDate
      _data.zcgl_customer_business.businessStatus = _data.jnpf_zcgl_customer_business_jnpf_businessStatus
      _data.zcgl_customer_business.businessRegistrationNumber = _data.jnpf_zcgl_customer_business_jnpf_businessRegistrationNumber
      _data.zcgl_customer_business.creditCode = _data.jnpf_zcgl_customer_business_jnpf_creditCode
      _data.zcgl_customer_business.organizationCode = _data.jnpf_zcgl_customer_business_jnpf_organizationCode
      _data.zcgl_customer_business.taxpayerNumber = _data.jnpf_zcgl_customer_business_jnpf_taxpayerNumber
      _data.zcgl_customer_business.enterpriseType = _data.jnpf_zcgl_customer_business_jnpf_enterpriseType
      _data.zcgl_customer_business.startTime = _data.jnpf_zcgl_customer_business_jnpf_startTime
      _data.zcgl_customer_business.endTime = _data.jnpf_zcgl_customer_business_jnpf_endTime
      _data.zcgl_customer_business.industry = _data.jnpf_zcgl_customer_business_jnpf_industry
      _data.zcgl_customer_business.approvalDate = _data.jnpf_zcgl_customer_business_jnpf_approvalDate
      _data.zcgl_customer_business.paidCapital = _data.jnpf_zcgl_customer_business_jnpf_paidCapital
      _data.zcgl_customer_business.stafsize = _data.jnpf_zcgl_customer_business_jnpf_stafsize
      _data.zcgl_customer_business.individualsNumber = _data.jnpf_zcgl_customer_business_jnpf_individualsNumber
      _data.zcgl_customer_business.registrationAuthority = _data.jnpf_zcgl_customer_business_jnpf_registrationAuthority
      _data.zcgl_customer_business.formerName = _data.jnpf_zcgl_customer_business_jnpf_formerName
      _data.zcgl_customer_business.englishName = _data.jnpf_zcgl_customer_business_jnpf_englishName
      _data.zcgl_customer_business.registeredAddress = _data.jnpf_zcgl_customer_business_jnpf_registeredAddress
      _data.zcgl_customer_business.businessScope = _data.jnpf_zcgl_customer_business_jnpf_businessScope
      return _data;
    },
    dataInfo(dataAll) {
      let _dataAll = dataAll
      _dataAll.jnpf_zcgl_customer_user_jnpf_contacts = _dataAll.zcgl_customer_user.contacts
      _dataAll.jnpf_zcgl_customer_user_jnpf_contactNumber = _dataAll.zcgl_customer_user.contactNumber
      _dataAll.jnpf_zcgl_customer_user_jnpf_email = _dataAll.zcgl_customer_user.email
      _dataAll.jnpf_zcgl_customer_user_jnpf_position = _dataAll.zcgl_customer_user.position
      _dataAll.jnpf_zcgl_customer_business_jnpf_legalRepresentative = _dataAll.zcgl_customer_business.legalRepresentative
      _dataAll.jnpf_zcgl_customer_business_jnpf_registeredCapital = _dataAll.zcgl_customer_business.registeredCapital
      _dataAll.jnpf_zcgl_customer_business_jnpf_establishmentDate = _dataAll.zcgl_customer_business.establishmentDate
      _dataAll.jnpf_zcgl_customer_business_jnpf_businessStatus = _dataAll.zcgl_customer_business.businessStatus
      _dataAll.jnpf_zcgl_customer_business_jnpf_businessRegistrationNumber = _dataAll.zcgl_customer_business.businessRegistrationNumber
      _dataAll.jnpf_zcgl_customer_business_jnpf_creditCode = _dataAll.zcgl_customer_business.creditCode
      _dataAll.jnpf_zcgl_customer_business_jnpf_organizationCode = _dataAll.zcgl_customer_business.organizationCode
      _dataAll.jnpf_zcgl_customer_business_jnpf_taxpayerNumber = _dataAll.zcgl_customer_business.taxpayerNumber
      _dataAll.jnpf_zcgl_customer_business_jnpf_enterpriseType = _dataAll.zcgl_customer_business.enterpriseType
      _dataAll.jnpf_zcgl_customer_business_jnpf_startTime = _dataAll.zcgl_customer_business.startTime
      _dataAll.jnpf_zcgl_customer_business_jnpf_endTime = _dataAll.zcgl_customer_business.endTime
      _dataAll.jnpf_zcgl_customer_business_jnpf_industry = _dataAll.zcgl_customer_business.industry
      _dataAll.jnpf_zcgl_customer_business_jnpf_approvalDate = _dataAll.zcgl_customer_business.approvalDate
      _dataAll.jnpf_zcgl_customer_business_jnpf_paidCapital = _dataAll.zcgl_customer_business.paidCapital
      _dataAll.jnpf_zcgl_customer_business_jnpf_stafsize = _dataAll.zcgl_customer_business.stafsize
      _dataAll.jnpf_zcgl_customer_business_jnpf_individualsNumber = _dataAll.zcgl_customer_business.individualsNumber
      _dataAll.jnpf_zcgl_customer_business_jnpf_registrationAuthority = _dataAll.zcgl_customer_business.registrationAuthority
      _dataAll.jnpf_zcgl_customer_business_jnpf_formerName = _dataAll.zcgl_customer_business.formerName
      _dataAll.jnpf_zcgl_customer_business_jnpf_englishName = _dataAll.zcgl_customer_business.englishName
      _dataAll.jnpf_zcgl_customer_business_jnpf_registeredAddress = _dataAll.zcgl_customer_business.registeredAddress
      _dataAll.jnpf_zcgl_customer_business_jnpf_businessScope = _dataAll.zcgl_customer_business.businessScope
      this.dataForm = _dataAll
    },
  },
}

</script>
